#! /bin/bash
# description:switch war package

BACKUP_DIR=$1
WAR_NAME_BACKUP=$2
WEBCONTAINER_DIR=$3
WAR_NAME_DEPLOY=$4

if [ -z ${WEBCONTAINER_DIR} ]
then 
 echo "Switch war failed! No webcontainer dir specifiey."
 exit 0
fi

if [ -z ${WAR_NAME_DEPLOY} ]
then 
 echo "Switch war failed! No deploy war name specified."
 exit 0
fi


if [ -z ${BACKUP_DIR} ]
then
 echo "Switch war failed! No backup dir specified."
 exit 0
fi

if [ -z ${WAR_NAME_BACKUP} ]
then
 echo "Switch war failed! No backup war name specified."
 exit 0
fi

echo "ln -s ${BACKUP_DIR}${WAR_NAME_BACKUP} ${WEBCONTAINER_DIR}${WAR_NAME_DEPLOY}"
ln -s ${BACKUP_DIR}${WAR_NAME_BACKUP} ${WEBCONTAINER_DIR}${WAR_NAME_DEPLOY}
